package com.chrray.position.domain;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;

/**
 * 用户收藏表 对象
 *
 * @author wusiwee
 * @email wusiwee@163.com
 * @since 1.0.1 2024-08-07
 */

@Data
@ApiModel(description = "用户收藏表")
@TableName("fd_user_favorites")
public class FdUserFavorites extends Model<FdUserFavorites> {
	@ApiModelProperty(value = "主键ID")
	@TableId(type = IdType.AUTO)
	private Long id;

	@ApiModelProperty(value = "岗位ID")
	private Long jobId;

	@ApiModelProperty(value = "用户ID")
	private Long userId;

	@ApiModelProperty(value = "创建时间")
	private Date createTime;

	private Integer delFlag;

	public boolean haCollected(Long userId,Long jobId) {
		LambdaQueryWrapper<FdUserFavorites> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(FdUserFavorites::getUserId, userId);
		queryWrapper.eq(FdUserFavorites::getJobId, jobId);
		return this.selectCount(queryWrapper) > 0;
	}

}
